import cn from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

import s from './style.module.css';

function BreadcrumbItem({ className, href, disabled, active, children }) {
	return (
		<Link
			className={cn(className, s.item, {
				[s.active]: active,
				[s.disabled]: disabled,
			})}
			to={href}
		>
			{children}
		</Link>
	);
}

BreadcrumbItem.propTypes = {
	className: PropTypes.string,
	prefix: PropTypes.string,
	href: PropTypes.string,
	disabled: PropTypes.bool,
	active: PropTypes.bool,
	children: PropTypes.node.isRequired,
};
BreadcrumbItem.defaultProps = {
	className: '',
	prefix: '/',
	disabled: false,
	active: false,
};

export default BreadcrumbItem;
